An image processing apparatus has been known which acquires image data by reading a document and detects a document region from the image data. For example, the image processing apparatus acquires an image containing a document region, detects coordinate values of edge candidate pixels based on the obtained image, calculates the tilting of the document region based on the detected coordinate values of the edge candidate pixels, and extracts coordinate values of edge end candidate pixels based on the detected coordinate values of the edge candidate pixels. Then, the image processing apparatus calculates a straight line corresponding to an edge based on the calculated tilting of the document region and the extracted coordinate values of edge end candidate pixels, and corrects the tilting of the document region on the basis of the calculated straight line corresponding to the edge, and crops the document region from the image based on the relevant straight line.
As another example, an image processing apparatus has been known which, in extracting a document region, compares a differential value with a threshold value of a pixel in order to determine whether or not the pixel is to be read out.
Also, an image reader which processes image data outputted from an image sensor has been known. The image reader includes a document region detection unit that detects pixels having density variation larger than a threshold as candidate points to be estimated as document end points, a document region correction unit that recognizes document end points indicating positions of document ends based on the position of the candidate points. The document region detection unit includes a density variation calculating unit that calculates density variation of the focused pixel based on image density of surrounding pixels, and a determination unit that detects the focused pixel as a candidate point when density of a prescribed number of consecutive pixels that continue either in scanning direction or in reverse scanning direction from the focused pixel after binarization at a prescribed slice level is same for each pixel. For a focused pixel for which density variation is less than a threshold and not less than a second threshold, the determination unit detects the focused pixel as a provisional candidate point when density of a prescribed number of consecutive pixels that continue either in scanning direction or reverse scanning direction from the focused pixel after binarization at a prescribed slice level is the same for each pixel.
Also, a document size detection apparatus that detects an edge of a document has been known. The document size detection apparatus includes a first document edge detection unit having a first calculation unit that calculates respective differences between a focused pixel and a plurality of pixels beginning from a pixel situated at a prescribed number of pixels before the focused pixel and continuing at an equal interval, a first comparison unit that compares each of the differences obtained by the first calculation unit with a threshold and detects a case where all the differences exceed the threshold, and a first document edge detection unit that, when, as a result of the comparison of the first comparison unit, all the differences exceed the threshold, detects the position of the focused pixel as a provisional edge, and when this state is repeated for a prescribed number of times, detects the position of the provisional edge as the document edge, a second document edge detection unit having a second calculation unit that calculates the difference between the focused pixel and the previous pixel, a second comparison unit that detects a case where the difference calculated by the second calculation unit exceeds a threshold, and a second document edge detection unit which, when threshold is exceeded in the range from the focused pixel to the prescribed number of pixels before the focused pixel for number of times not less than a prescribed number, detects the position of the focused pixel as a document edge, and when this operation is performed in main scanning direction, detects the final position renewed as the document edge position as the document edge, and a size determination unit that performs size detection by detecting the larger one of the document edge positions detected by the first and the second document edge detection units as the document edge.
Related art is disclosed in Japanese Laid-open Patent Publications No. 2009-218953, 2010-263434, 2002-252747 and 10-224563.